#!/bin/bash

#echo "testing characteristic type $1"

set -x

for imgname in ../images/*.pgm 
do
  contextencode -ct 6 -cf goodcc/lennagtw.ctd -e 0 $imgname temp/temp.bits
  contextdecode -cf goodcc/lennagtw.ctd -i $imgname temp/temp.bits temp/temp.pgm
  imgdist temp/temp.pgm $imgname
  echo ""
done

for imgname in ../images/*.ppm 
do
  contextencode -ct 6 -cf goodcc/lennagtw.ctd -e 0 $imgname temp/temp.bits
  contextdecode -cf goodcc/lennagtw.ctd -i $imgname temp/temp.bits temp/temp.ppm
  imgdist temp/temp.ppm $imgname
  echo ""
done

for imgname in ../images/lenna.pgm
do
  contextencode -ct 6 -cf goodcc/lennagtw.ctd -e 0 -s 4  $imgname temp/temp.bits
  contextdecode -cf goodcc/lennagtw.ctd -i $imgname temp/temp.bits temp/temp.pgm
  imgdist temp/temp.pgm $imgname
  echo ""
done

for imgname in ../images/lenna.pgm
do
  contextencode -ct 1 -cf goodcc/lenna1greedy.ctd -e 0 -s 8  $imgname temp/temp.bits
  contextdecode -cf goodcc/lenna1greedy.ctd -i $imgname temp/temp.bits temp/temp.pgm
  imgdist temp/temp.pgm $imgname
  echo ""
done

